import { cGet, cSet, cRemove} from './utils/saveMethod'
import logoImg from '@/assets/logo.png'

const userInfo = {
  // 配置logo图片
  logoImg:logoImg,

  /* 操作cookies */
  get:(name)=>{
    return cGet(name)
  },
  set:(name, value)=>{
    cSet(name, value)
  },
  remove:(name)=>{
    cRemove(name)
  },

  // 登录
  sign:(data)=>{
    let obj = {
      token:data.loginVo.token,
      nickName:data.member.nickName,
      img:data.member.img
    }
    Object.keys(obj).forEach((item=>{
      cSet(item,obj[item])
    }))
  },
  // 退出
  signOut:()=>{
    let list = ['token','nickName','img']
    list.forEach((item=>{
      cRemove(item)
    }))
  }
}
export default userInfo